/*
 * Main.java
 *
 * Created on 07 March 2008, 16:30
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */
import java.util.*;
import java.io.*;
/**
 *
 * @author Hussein Patwa
 */
public class Main {
    ArrayList spatialObjectList = new ArrayList();
    NeighbourhoodInfo neighbourhood;
    /** Creates a new instance of Main */
    public Main() {
        //first read the data file
        csvinput datafile = new csvinput(new File("data.csv"),50,6);
        String[][] values = datafile.getValues();
        for(int i=0;i<datafile.getNumberOfRows();i++){
            spatialobject so = new spatialobject(new Double(values[i][3]).doubleValue(),new Double(values[i][4]).doubleValue(),new Double(values[i][5]).doubleValue());
            spatialObjectList.add(so);
        }
        //read the neighbourhood data
        Vector matdata = new Vector();
        datafile = new csvinput(new File("abdnMat.csv"),50,50);
        values = datafile.getValues();
        for(int i=0;i<datafile.getNumberOfRows();i++){
            Vector row = new Vector();
            for(int j=0;j<datafile.getNumberOfColumns();j++){
                double tmp = new Double(values[i][j]).doubleValue();
                row.add(tmp);
            }
            matdata.add(row);
        }
        neighbourhood = new NeighbourhoodInfo(matdata);
        //call local trending
        int index = 2;
        int maxLength = 6;
        int minLength = 2;
        double min_conf = 2.0;
        local trend = new local(neighbourhood,spatialObjectList,index,maxLength,minLength,min_conf);
    }
    
    public static void main(String[] args){
        new Main();
    }
    
}
